<?php
/**
 * Created by PhpStorm.
 * User: luxuewen_gz
 * Date: 2018/12/28
 * Time: 16:25
 */

namespace app\admin\validate;


use think\Validate;

class Role extends Validate
{
    protected $rule = [
        'id'                    =>  'require|integer',
        'permission_ids'        =>  'array',
        'role_name'             =>  'require|min:2',
    ];

    protected $message = [
        'permission_ids.array'          =>  '角色权限必须是数组',
        'role_name.require'             =>  '缺少角色名',
        'role_name.min'                 =>  '角色名至少两位',
        'id.require'                    =>  '缺少ID',
        'id.integer'                    =>  'ID必须是整数'
    ];
    protected $scene = [
        'add'       =>  ['permission_ids', 'role_name'],
        'edit'      =>  ['id', 'permission_ids', 'role_name'],
        'delete'    =>  ['id']
    ];

}